Skip to content

Conversation

@3v1n0
Copy link

@3v1n0 3v1n0 commented Nov 21, 2025

The output of stty --all was not really matching GNU one, adjust it to follow the same logic

Before:

--- /tmp/gnu-stty	2025-11-21 01:41:14.909020716 +0100
+++ /tmp/rust-stty	2025-11-21 00:38:42.324215733 +0100
@@ -1,10 +1,6 @@
-speed 38400 baud; rows 57; columns 112; line = 0;
-intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
-eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
-werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
--parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
--ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
--iuclc -ixany -imaxbel iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
-echoctl echoke -flusho -extproc
+speed 38400 baud; rows 57; columns 115; line = 0;
+intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
+-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts 
+-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixoff -tandem ixon -ixany -imaxbel iutf8 
+opost -olcuc -ocrnl onlcr -onocr -onlret -ofdel nl0 cr0 tab0 bs0 vt0 ff0 
+isig icanon iexten echo echoe echok -echonl -noflsh -tostop -echoprt echoctl echoke -flusho -extpro```

After:

--- /tmp/gnu-stty	2025-11-21 01:41:14.909020716 +0100
+++ /tmp/rust-stty	2025-11-21 04:31:16.511313289 +0100
@@ -4,7 +4,7 @@
 werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
 -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
 -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
--iuclc -ixany -imaxbel iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
-echoctl echoke -flusho -extproc
+-ixany -imaxbel iutf8
+opost -olcuc -ocrnl onlcr -onocr -onlret -ofdel nl0 cr0 tab0 bs0 vt0 ff0
+isig icanon iexten echo echoe echok -echonl -noflsh -tostop -echoprt echoctl
+echoke -flusho -extproc

Highlight is not great for word diffing, but well:

❯ wdiff /tmp/stty-out /tmp/rstty-out 
speed 38400 baud; rows 57; columns 112; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
[--iuclc-]
-ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret [--ofill-] -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh [--xcase-] -tostop -echoprt echoctl
echoke -flusho -extpro

After the flags we're missing will be included upstream, the diff will be actually none.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/cksum/cksum-base64-untagged. tests/cksum/cksum-base64-untagged is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@3v1n0 3v1n0 force-pushed the stty-better-printing branch 2 times, most recently from b287c72 to 9c6d77f Compare November 21, 2025 06:33
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@3v1n0 3v1n0 force-pushed the stty-better-printing branch 2 times, most recently from 46cbbc3 to b989937 Compare November 21, 2025 06:57
@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum-base64-untagged is no longer failing!

@3v1n0 3v1n0 force-pushed the stty-better-printing branch from b989937 to bae055d Compare November 21, 2025 07:32
@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum-base64-untagged is no longer failing!

// Status character
// ("status", S::VSTATUS), // Not supported by nix
// Minimum number of characters for noncanonical read.
// ("min", S::VMIN),
Copy link
Contributor

@ChrisDryden ChrisDryden Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that the nix compatibility is more about the platform that it is being built on?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the code, but there are no such definitions... I wanted to submit a change there too, but I'm unsure about what platforms are supported, so I'd rather wait for someone having it to support it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this specific case, actually it was defined, but I commented this out since we use the value differently in the code

target_os = "macos"
))]
// Not supported by nix.
// Flag::new("ofill", O::OFILL),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to nix-rust/nix#2701 also

3v1n0 added a commit to 3v1n0/nix that referenced this pull request Nov 21, 2025
@3v1n0 3v1n0 mentioned this pull request Nov 21, 2025
3 tasks
@3v1n0 3v1n0 force-pushed the stty-better-printing branch from bae055d to 173ad5a Compare November 21, 2025 22:04
Flag::new("ixoff", I::IXOFF),
Flag::new("tandem", I::IXOFF).hidden(),
// not supported by nix
// Flag::new("iuclc", I::IUCLC),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but this is being added to libc rust-lang/libc#4846 then we need to update nix

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

3v1n0 added a commit to 3v1n0/nix that referenced this pull request Nov 21, 2025
3v1n0 added a commit to 3v1n0/nix that referenced this pull request Nov 21, 2025
@3v1n0 3v1n0 force-pushed the stty-better-printing branch from 173ad5a to 65b5c7a Compare November 21, 2025 23:57
3v1n0 added a commit to 3v1n0/nix that referenced this pull request Nov 22, 2025
3v1n0 added a commit to 3v1n0/nix that referenced this pull request Nov 22, 2025
@3v1n0 3v1n0 force-pushed the stty-better-printing branch 5 times, most recently from 704772b to fa39e80 Compare November 22, 2025 04:00
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

Do the same as GNU stty when it has to prints the parameter, doing
proper text wrapping
It is just an alias for ixoff, and it's marked with `OMIT` in GNU
version
It's only supported by BSD, aix and solaris, but still available in nix
List the remaining flags that GNU stty support, they cannot be be listed
yet since we have no nix support for them, but it's better to keep the
lists in sync so that it's easier to enable what will be supported in
future
This is going to be supported via those PRs, so let's track them to make
it easier to support it in future
Until nix won't include it we can safely just rely on the libc definition
Nix now supports the line discipline parameter in various platforms,
so use upstream definition instead of going through libc

See: nix-rust/nix#1802
@sylvestre sylvestre force-pushed the stty-better-printing branch from f0de189 to 61ce79b Compare November 22, 2025 08:12
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants